How to find the period of the function